package com.example.adapter.demo.power.interfaceadapter;


/**
 * 适配器
 * 将国标220V交流电转换成5V直流电
 */
public class PowerAdapter implements DC {

    private AC220 ac220;

    public PowerAdapter(AC220 ac220) {
        this.ac220 = ac220;
    }

    @Override
    public void outputDC5V() {
        int input = ac220.output220V();
        int output = input / 44;
        System.out.println(String.format("DC5Adapter 将:%dV电压转换成:%dV", input, output));
    }

    @Override
    public void outputDC12V() {
        int input = ac220.output220V();
        int output = 12;
        System.out.println(String.format("DC5Adapter 将:%dV电压转换成:%dV", input, output));
    }

    @Override
    public void outputDC24V() {
        int input = ac220.output220V();
        int output =24;
        System.out.println(String.format("DC5Adapter 将:%dV电压转换成:%dV", input, output));
    }

    @Override
    public void outputDC36V() {
        int input = ac220.output220V();
        int output = 36;
        System.out.println(String.format("DC5Adapter 将:%dV电压转换成:%dV", input, output));
    }

}
